package com.imooc.user.controller;

import com.imooc.api.controller.user.HelloControllerApi;
import com.imooc.grance.result.GraceJsonResult;
import com.imooc.utils.RedisOperator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.service.ApiInfo;

import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 *
 * @auther Levi
 * @Date: 2021/03/12/17:22
 * @Description:
 */
@RestController
public class HelloController implements HelloControllerApi {

    @Autowired
    private RedisOperator redis;

    private static Logger logger = LoggerFactory.getLogger(HelloController.class);

    @Override
    public Object hello() {

//        logger.info("info: ");
//        logger.warn("warn: ");
//        logger.debug("debug: ");
//        logger.error("error: ");
//        return "hello springcloud";
        return GraceJsonResult.ok(new Date());
    }

    @GetMapping("/testRedis")
    public GraceJsonResult testRedis() {
        redis.set("age", "18");
        return GraceJsonResult.ok(redis.get("age"));
    }
}
